package org.linuxsogood.boot.test;

/**
 * @author honway.liu
 * @date 2019-07-16 21:36
 * @email gm100861@gmail.com
 * @blog http://linuxsogood.org
 *
 * java中属性不支持多态
 */
public class A {

    public String s = "A";


    public String getS() {
        return s;
    }

    public void setS(String s) {
        this.s = s;
    }
}

class B extends A{
    public String s = "B";
    public void setS(String s){
        this.s = s;
    }
    public String getS(){
        return this.s;
    }
    public static void main(String[] args){
        A a = new A();
        B b = new B();
        a.setS("[AA]");
        b.setS("[BB]");
        a = b;
        System.out.print(a.s);
        System.out.print(b.s);
        System.out.print(a.getS());
        System.out.print(b.getS());
    }
}
